home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50b Issue 142 (CD142b) (August 1998).iso / handson / Java / sc20form.jar / com / supercede / forms / SuperCedeRuntimeInfo.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-01-28  |  2.5 KB  |  114 lines

  1. package com.supercede.forms;
  2.  
  3. import java.awt.Component;
  4. import java.io.Serializable;
  5. import java.util.Enumeration;
  6. import java.util.Vector;
  7.  
  8. public class SuperCedeRuntimeInfo implements Serializable {
  9.    private Vector connections;
  10.    protected Vector layoutConstraintsList = new Vector();
  11.    private static final long serialVersionUID = 1013082004010516618L;
  12.    private static final int _version = 1;
  13.    private int version = 1;
  14.  
  15.    public int getNumConnections() {
  16.       return this.connections.size();
  17.    }
  18.  
  19.    public SuperCedeConnectionDescriptor getConnection(int var1) {
  20.       return (SuperCedeConnectionDescriptor)this.connections.elementAt(var1);
  21.    }
  22.  
  23.    public void setConnections(Vector var1) {
  24.       this.connections = var1;
  25.    }
  26.  
  27.    public void addConnection(SuperCedeConnectionDescriptor var1) {
  28.       this.connections.addElement(var1);
  29.    }
  30.  
  31.    public boolean removeConnection(SuperCedeConnectionDescriptor var1) {
  32.       return this.connections.removeElement(var1);
  33.    }
  34.  
  35.    public Enumeration getConnectionElements() {
  36.       return this.connections.elements();
  37.    }
  38.  
  39.    public synchronized void addLayoutConstraints(Component var1, Object var2) {
  40.       int var3 = this.findLayoutConstraints(var1);
  41.       if (var3 < 0) {
  42.          this.layoutConstraintsList.addElement(new LayoutConstraintsInfo(var1, var2));
  43.       } else {
  44.          LayoutConstraintsInfo var4;
  45.          try {
  46.             var4 = (LayoutConstraintsInfo)this.layoutConstraintsList.elementAt(var3);
  47.          } catch (ArrayIndexOutOfBoundsException var5) {
  48.             var4 = null;
  49.          }
  50.  
  51.          var4.constraints = var2;
  52.       }
  53.    }
  54.  
  55.    public synchronized void removeLayoutConstraints(Component var1) {
  56.       int var2 = this.findLayoutConstraints(var1);
  57.       if (var2 >= 0) {
  58.          try {
  59.             this.layoutConstraintsList.removeElementAt(var2);
  60.          } catch (ArrayIndexOutOfBoundsException var3) {
  61.          }
  62.       }
  63.    }
  64.  
  65.    public synchronized Object getLayoutConstraints(Component var1) {
  66.       int var3 = this.findLayoutConstraints(var1);
  67.       Object var2;
  68.       if (var3 < 0) {
  69.          var2 = null;
  70.       } else {
  71.          try {
  72.             LayoutConstraintsInfo var4 = (LayoutConstraintsInfo)this.layoutConstraintsList.elementAt(var3);
  73.             var2 = var4.constraints;
  74.          } catch (ArrayIndexOutOfBoundsException var5) {
  75.             var2 = null;
  76.          }
  77.       }
  78.  
  79.       return var2;
  80.    }
  81.  
  82.    private int findLayoutConstraints(Component var1) {
  83.       int var2 = 0;
  84.  
  85.       int var3;
  86.       for(var3 = this.layoutConstraintsList.size(); var2 < var3; ++var2) {
  87.          LayoutConstraintsInfo var4;
  88.          try {
  89.             var4 = (LayoutConstraintsInfo)this.layoutConstraintsList.elementAt(var2);
  90.          } catch (ArrayIndexOutOfBoundsException var5) {
  91.             var4 = null;
  92.          }
  93.  
  94.          if (var4 == null) {
  95.             var2 = var3;
  96.             break;
  97.          }
  98.  
  99.          if (var4.comp == var1) {
  100.             break;
  101.          }
  102.       }
  103.  
  104.       return var2 >= var3 ? -1 : var2;
  105.    }
  106.  
  107.    public void runTimeInit(Object var1) {
  108.       for(int var2 = 0; var2 < this.connections.size(); ++var2) {
  109.          this.getConnection(var2).runTimeInit(var1);
  110.       }
  111.  
  112.    }
  113. }
  114.